package com.niodata.dp.plugin.core;

public abstract class AbstractFilePipePlugin<I extends Input, O extends Output> extends AbstractDpTaskPlugin {

  @Override
  public void execute() throws Exception {
    if (this.isOutPut()) {
      this.writeOut();
    } else {
      this.readFrom();
    }
  }

  public abstract boolean isOutPut();

  public abstract void writeOut() throws Exception;

  public abstract void readFrom() throws Exception;


  public I getConfig() {
    return (I) super.getContext().getConfig();
  }

}
